<template>
  <div class="home">
    <div class="el-header">
      <div class="navMenuTip" @click="openNavMenu = false" v-show="openNavMenu">点击展开导航菜单栏</div>
      <div class="navMenuTip" @click="openNavMenu = true" v-show="openNavMenu == false">点击关闭导航菜单栏</div>
      <div style="margin-left: 5%;">智慧校园查询系统</div>
      <div class="el-icon--right">
        <el-avatar :src="imgSrc" style="margin-top: 10px;"></el-avatar>
        <el-link type="info" style="margin-left: 10px;margin-bottom: 10px;" @click="gotoLogin">
          <i class="el-icon-s-custom" ></i> 退出登录
        </el-link>
      </div>
    </div>
    <el-container>
      <el-container>
        <el-aside width="250px" v-if="openNavMenu == false">
          <navMenu></navMenu>
        </el-aside>
        <el-container>
          <el-main>
            <contents></contents>
          </el-main>
          <el-footer height='45px'>@ zspt 中山职业技术学院 信息工程学院</el-footer>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import navMenu from '@/components/navMenu'
import contents from '../components/content/index'

export default {
  name: 'Home',
  components: {
    navMenu,
    contents
  },
  data() {
    return {
      imgSrc: require('../assets/img/avatar.jpg'),
      openNavMenu: false
    }
  },
  methods: {
    gotoLogin() {
      this.$router.push('/');
    }
  }
}
</script>

<style>
  .el-header {
    background-color: #006b9d;
    opacity: 0.8;
    color: #ffffff;
    line-height: 60px;
    font-size: 30px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
  }
  
  .navMenuTip {
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
  }
  
  .el-footer {
    color: #ffffff;
    line-height: 45px;
    background-color: #006b9d;
    opacity: 0.8;
  }
  
  .el-aside {
    background-color: #545c64;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    height: 90vh;
    background-size: cover;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>
